package cn.ytnet.shangyun.service.basic.entity;

import org.springframework.stereotype.Component;

import javax.persistence.*;

/**
 * Created by cyongk on 2015/12/8.
 * ClassName：GoodsUnitEntity
 * ChineseName：商品单位类
 */
@Component("goodsUnitEntity")
@Entity
@Table(name = "T_GoodsUnit", schema = "crebas", catalog = "")
public class GoodsUnitEntity {
    private String pkTGoodsunitId;
    private String unitName;
    private String unitPhoneticCode;

    @Id
    @Column(name = "pk_t_goodsunit_id", nullable = false, length = 4)
    public String getPkTGoodsunitId() {
        return pkTGoodsunitId;
    }

    public void setPkTGoodsunitId(String pkTGoodsunitId) {
        this.pkTGoodsunitId = pkTGoodsunitId;
    }

    @Basic
    @Column(name = "unit_name", nullable = false, length = 30)
    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    @Basic
    @Column(name = "unit_phonetic_code", nullable = false, length = 10)
    public String getUnitPhoneticCode() {
        return unitPhoneticCode;
    }

    public void setUnitPhoneticCode(String unitPhoneticCode) {
        this.unitPhoneticCode = unitPhoneticCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GoodsUnitEntity that = (GoodsUnitEntity) o;

        if (pkTGoodsunitId != null ? !pkTGoodsunitId.equals(that.pkTGoodsunitId) : that.pkTGoodsunitId != null)
            return false;
        if (unitName != null ? !unitName.equals(that.unitName) : that.unitName != null) return false;
        return unitPhoneticCode != null ? unitPhoneticCode.equals(that.unitPhoneticCode) : that.unitPhoneticCode == null;

    }

    @Override
    public int hashCode() {
        int result = pkTGoodsunitId != null ? pkTGoodsunitId.hashCode() : 0;
        result = 31 * result + (unitName != null ? unitName.hashCode() : 0);
        result = 31 * result + (unitPhoneticCode != null ? unitPhoneticCode.hashCode() : 0);
        return result;
    }
}
